home *** CD-ROM | disk | FTP | other *** search
- Path: gradine.cis.upenn.edu!skramiah
- From: skramiah@gradine.cis.upenn.edu (Senthil K. Ramiah)
- Newsgroups: comp.lang.c
- Subject: Link list Vs Memory block
- Date: 16 Feb 1996 02:47:34 GMT
- Organization: University of Pennsylvania
- Message-ID: <4g0r86$fk5@netnews.upenn.edu>
- NNTP-Posting-Host: gradine.cis.upenn.edu
-
- Hi Everyone
- Consider the following program segment.
-
- struct struct_s
- {
- int i;
- char c;
- };
- main()
- {
- struct struct_s *s1;
-
- s1 = malloc(sizeof(struct struct_s) * 2);
-
- s1->i =1; s1->c ='a';
- s1++;
- s1->i =2; s1->c = 'b';
- }
-
- My questions are:
-
- 1) How safe is it to use the above method
- instead of a link list.
-
- 2) Will this implementation work on all platforms.
-
- Thanx.
- -Senthil.
-
- skramiah@gradient.cis.upenn.edu
- --
- fortune
-